package j.framework.tags.easyui;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;


/**
 * easyui格式的linkButton,代码如下：
 * <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="addModule();">增加模块</a>
 * User: jason
 * Date: 2014/12/31 14:43
 */
public class LinkButtonTag extends SimpleTagSupport {
    private String iconKey;
    private String onClick;
    private String name;//按钮名称
    @Override
    public void doTag() throws JspException, IOException {
        JspWriter writer = this.getJspContext().getOut();
        writer.write("<a href=\"javascript:void(0);\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-");
        writer.write(iconKey);
        writer.write("'\" onclick=\"");
        writer.write(onClick);
        writer.write("\">");
        writer.write(name);
        writer.write("</a>");
    }

    public void setIconKey(String iconKey) {
        this.iconKey = iconKey;
    }

    public void setOnClick(String onClick) {
        this.onClick = onClick;
    }

    public void setName(String name) {
        this.name = name;
    }
}
